Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: do not build tests for Release build and cleanups #5916

Closed
wants to merge 12 commits into from

Conversation

tchaikov
Copy link
Contributor

fixes #2445

@riversand963
Copy link
Contributor

Appveyor seems to be broken by the PR.

@tchaikov
Copy link
Contributor Author

@riversand963 could you help review this change?

@tchaikov
Copy link
Contributor Author

ping?

@tchaikov
Copy link
Contributor Author

tchaikov commented Dec 10, 2019

@riversand963 @siying , is there anything i can do to progress this change? i just found that #6098 was merged. it addresses this issue in a different way. but i think this this change is still relevant.

@riversand963
Copy link
Contributor

Will take a look.


add_executable(db_bench${ARTIFACT_SUFFIX}
tools/db_bench.cc
tools/db_bench_tool.cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little bit confused why it can still build after removing this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, added db_bench_tool.cc back . the reason it built is that gflags is not found by cmake as neither do we have Findgflags.cmake nor {gflagsConfig,gflags-config}.cmake in the (ancient) xenial CI node created by travis.

i added Findgflags.cmake to address this issue in this PR.

@tchaikov tchaikov force-pushed the wip-cmake branch 2 times, most recently from e6dd0ad to 7273261 Compare December 11, 2019 03:23
@siying
Copy link
Contributor

siying commented Dec 12, 2019

Travis fails. Can you take a look?

@tchaikov tchaikov force-pushed the wip-cmake branch 2 times, most recently from 6194007 to a7a1d05 Compare December 13, 2019 03:14
@tchaikov
Copy link
Contributor Author

@siying yes. fixed, rebased and repushed.

cmake pass '-DNDEBUG' to compiler when compiling non-Debug builds.
and rocksdb's tests are short-circuited if the "NDEBUG" macro is defined,
so the "Release" builds fail when building tests.

in this change, cmake disables `WITH_TESTS` option if `CMAKE_BUILD_TYPE`
is `Release`. this also maps how `Makefile` defines `dbg` and `release`
targets. in `Makefile`, `release` target does not depend on `$(TESTS)`,
while `dbg` does.

fixes facebook#2445

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
so we can reference it without worrying about its dependencies like
gtest. testharness is used by table_reader_bench.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
`WITH_GFLAGS` is enabled/disabled depending on the
building system, so it'd be simpler if we could define it using
`CMAKE_DEPENDENT_OPTION`.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
unfold the loop, and remove the unused dependencies from linked
libraries.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
TEST_EXES and C_TEST_EXES are just aliases, so remove them

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
* no need to use a loop for building it
* no need to set properties like `EXCLUDE_FROM_DEFAULT_BUILD_RELEASE`,
  these properties are not read by anybody
* no need to link against testutillib

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
newer libgflags-dev ships with cmake support, but libgflags-dev 2.1.2-3
shipped by xenial does not. let's add the find_package() support. so our
CI can build with gflags

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
as we don't have libgflags-dev installed on mingw, and the toolchain
is not MSVC. please note, currently WITH_GFLAGS is OFF by default on
MINGW, but it's still better to be explicit.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
since WITH_GFLAGS is ON by default on OSX, we need to install or or
disable it explicitly. it'd be better to install it for better coverage
of the CI test.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
stress_tool/batched_ops_stress.cc:178:41: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
2822    std::array<std::string, 10> keys = {"0", "1", "2", "3", "4",
2823                                        ^~~~~~~~~~~~~~~~~~~~~~~~
28241 error generated.

see the discussions at
https://stackoverflow.com/questions/22501368/why-wasnt-a-double-curly-braces-syntax-preferred-for-constructors-taking-a-std
and
https://en.cppreference.com/w/cpp/container/array

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siying is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@siying
Copy link
Contributor

siying commented Dec 13, 2019

Thank you for your contribution and your patient!

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in ac304ad.

wolfkdy pushed a commit to wolfkdy/rocksdb that referenced this pull request Dec 22, 2019
Summary:
fixes facebook#2445
Pull Request resolved: facebook#5916

Differential Revision: D19031236

fbshipit-source-id: bc3107b6b25a01958677d7cb411b1f381aae91c6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compile error with db/db_test_util.cc
4 participants